package com.ymatou.iapi.accounting.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;

public class CreateAccountCall extends YmatouBaseCall {

    private static String opurl ="api/Account/CreateAccount";

    public CreateAccountCall() {
        super("http://accounting.iapi.ymatou.com/", opurl, "POST", "JSON");
    }
    @Override
    public void addDefHeader() {
        client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
        client.addHeader("Content-Type", "application/json; charset=UTF-8");
    }

    //获取 accountid
    public String getAccountId() throws Exception {
        String cid = null;
        cid = new JSONObject(getReturnData()).getJSONObject("Data").getString("AccountId");
        return cid;
    }

    //获取 Status
    public int getStatus() {
        int status = 0;
        try {
            status = new JSONObject(getReturnData()).getInt("StatusCode");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return status;
    }

    //获取 Msg
    public String getMsg() {
        String message = null;
        try {
            message = new JSONObject(getReturnData()).getString("Message");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return message;
    }
}
